using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ImageAnalystTools._DeepLearning
{
    /// <summary>
    /// <para>Non Maximum Suppression</para>
    /// <para>Identifies duplicate features from the output of the Detect Objects Using Deep Learning tool as a postprocessing step and creates a new output with no duplicate features. The Detect Objects Using Deep Learning tool can return more than one bounding box or polygon for the same object, especially as a tiling side effect. If two features overlap more than a given maximum ratio, the feature with the lower confidence value will be removed.</para>
    /// <para>作为后处理步骤，从使用深度学习检测对象工具的输出中识别重复的特征，并创建没有重复特征的新输出。使用深度学习检测对象工具可以为同一对象返回多个边界框或多边形，尤其是作为切片的副作用。如果两个要素重叠超过给定的最大比率，则置信度值较低的要素将被移除。</para>
    /// </summary>    
    [DisplayName("Non Maximum Suppression")]
    public class NonMaximumSuppression : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public NonMaximumSuppression()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_featureclass">
        /// <para>Input Feature Class</para>
        /// <para>The input feature class or feature layer containing overlapping or duplicate features.</para>
        /// <para>包含重叠或重复要素的输入要素类或要素图层。</para>
        /// </param>
        /// <param name="_confidence_score_field">
        /// <para>Confidence Score Field</para>
        /// <para>The field in the feature class that contains the confidence scores as output by the object detection method.</para>
        /// <para>要素类中包含对象检测方法输出的置信度分数的字段。</para>
        /// </param>
        /// <param name="_out_featureclass">
        /// <para>Output Feature Class</para>
        /// <para>The output feature class with the duplicate features removed.</para>
        /// <para>移除了重复要素的输出要素类。</para>
        /// </param>
        public NonMaximumSuppression(object _in_featureclass, object _confidence_score_field, object _out_featureclass)
        {
            this._in_featureclass = _in_featureclass;
            this._confidence_score_field = _confidence_score_field;
            this._out_featureclass = _out_featureclass;
        }
        public override string ToolboxName => "Image Analyst Tools";

        public override string ToolName => "Non Maximum Suppression";

        public override string CallName => "ia.NonMaximumSuppression";

        public override List<string> AcceptEnvironments => ["extent", "geographicTransformations", "outputCoordinateSystem", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_featureclass, _confidence_score_field, _out_featureclass, _class_value_field, _max_overlap_ratio];

        /// <summary>
        /// <para>Input Feature Class</para>
        /// <para>The input feature class or feature layer containing overlapping or duplicate features.</para>
        /// <para>包含重叠或重复要素的输入要素类或要素图层。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Feature Class")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_featureclass { get; set; }


        /// <summary>
        /// <para>Confidence Score Field</para>
        /// <para>The field in the feature class that contains the confidence scores as output by the object detection method.</para>
        /// <para>要素类中包含对象检测方法输出的置信度分数的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Confidence Score Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _confidence_score_field { get; set; }


        /// <summary>
        /// <para>Output Feature Class</para>
        /// <para>The output feature class with the duplicate features removed.</para>
        /// <para>移除了重复要素的输出要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Feature Class")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_featureclass { get; set; }


        /// <summary>
        /// <para>Class Value Field</para>
        /// <para>The class value field in the input feature class. If not specified, the tool will use the standard class value fields Classvalue and Value. If these fields do not exist, all features will be treated as the same object class.</para>
        /// <para>输入要素类中的类值字段。如果未指定，该工具将使用标准类值字段 Classvalue 和 Value。如果这些字段不存在，则所有要素都将被视为同一对象类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Class Value Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _class_value_field { get; set; } = null;


        /// <summary>
        /// <para>Max Overlap Ratio</para>
        /// <para>The maximum overlap ratio for two overlapping features. This is defined as the ratio of intersection area over union area. The default is 0.</para>
        /// <para>两个重叠要素的最大重叠率。这被定义为交集面积与联合面积的比率。默认值为 0。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Max Overlap Ratio")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _max_overlap_ratio { get; set; } = 0;


        public NonMaximumSuppression SetEnv(object extent = null, object geographicTransformations = null, object outputCoordinateSystem = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(extent: extent, geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}